Skip to content

test: add unit tests for useMultiSigProposals hook - #900

Open
Horlarmmy wants to merge 1 commit into
Iris-IV:mainfrom
Horlarmmy:feature/unittests-for-multisig
Open

test: add unit tests for useMultiSigProposals hook#900
Horlarmmy wants to merge 1 commit into
Iris-IV:mainfrom
Horlarmmy:feature/unittests-for-multisig

Conversation

@Horlarmmy

Copy link
Copy Markdown

Summary

Added unit test coverage for useMultiSigProposals hook, which manages multi-sig proposal state (creation, signing, cancellation, execution) via localStorage.

Changes

src/__tests__/hooks/useMultiSigProposals.test.tsx (new)

194 lines covering 12 test cases across 5 describe groups:

Group Tests
Initial state Empty localStorage → empty proposals; loads & filters by campaignId; re-filters on campaignId change
Error handling Corrupted localStorage JSON → gracefully returns []
createProposal Creates pending proposal & updates state immediately; no-ops when walletAddress is null; no-ops when active proposal exists; persists to localStorage
signProposal Marks caller's signer entry as signed; transitions status to ready when threshold met; no-ops when walletAddress is null
cancelProposal / markExecuted Sets status to cancelled; sets status to executed with txHash

Verification

Imports and patterns match existing hook tests (useCampaign.test.tsx). No changes were needed to the source hook — the hook already updates state synchronously inside createProposal, which satisfies the "refetch after submission" acceptance criterion.

Closes #803

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Horlarmmy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@sshdopey

Copy link
Copy Markdown
Contributor

Auto-review failed (API error). Leaving PR for human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Testing] Add unit tests for useMultiSigProposals hook

2 participants